import numpy as np
import networkx as nx
import pickle, os, time, sys

def allocate_data(N):
	Q = np.genfromtxt('./Data/Prob/Q.txt', delimiter=',', )
	y = np.loadtxt("./Data/Prob/y.txt")
	Q_block = np.vsplit(Q, N)
	y_block = np.hsplit(y, N)
	for i in range(N):
		os.makedirs(os.path.dirname(f"Data/N={N}/Q_allocated_{i}.txt"), exist_ok=True)
		np.savetxt(f"Data/N={N}/Q_allocated_{i}.txt", Q_block[i], fmt='%.8f', delimiter=',')
		os.makedirs(os.path.dirname(f"Data/N={N}/y_allocated_{i}.txt"), exist_ok=True)
		np.savetxt(f"Data/N={N}/y_allocated_{i}.txt", y_block[i], fmt='%.8f', delimiter=',')

if __name__ == "__main__":
	for i in range(5):
		allocate_data(i+1)
	print('over')
